package core;

public class StopWatch {

	private long start;
	private long stop;
	private final String id;
	private long elapsed;

	public StopWatch(String id) {
		this.id = id;
	}

	public void start() {
		this.start = System.currentTimeMillis();
	}

	public long stop() {
		this.stop = System.currentTimeMillis();
		this.elapsed = this.stop - this.start;
		System.out.println(this);
		return this.elapsed;
	}

	@Override
	public String toString() {
		return this.id + ": " + this.elapsed + " ms";
	}
}
